﻿<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！-->
    <title>学生惠后台管理系统</title>
    <link rel="stylesheet" href="/App/Admin/public/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="/App/Admin/public/css/style.css"/>
</head>
<body>
<div class="loginBg">
    <div class="loginBox">
        <form>
            <span class="text">学生惠后台管理系统</span>
            <input type="text" class="inp form-control"   id="admin_username"   placeholder="请输入用户名">
            <input type="password" class="inp form-control"   id="admin_password"  placeholder="请输入密码">
            <div class="codeBox">
                <input type="password" class="inp form-control"  id="admin_valid"   placeholder="请输入验证码">
                <img src="{:U("Login/sendAdminValid")}"  id='valid'  onclick='javascript:changeValid()'  class="pic">
            </div>
            <button type="submit"  id="login-lq" class="btn btn-primary blue">登 录</button>
            <div style="text-align: center;font-size:16px;color:#F00" id="infotest">    </div>

        </form>
    </div>
</div>
       <script src="/App/Admin/public/js/jquery-2.1.1.min.js"></script>
       
    <script>  
	     function changeValid(){
	        	$("#valid").attr('src','{:U("Login/sendAdminValid?r=")}?r='+Math.random());
	        }
    </script>
	
	<script type="text/javascript"> 
	$('#login-lq').on('click',function(){
        var username = $('#admin_username').val();
	var password = $('#admin_password').val();
	var valid = $('#admin_valid').val();
	
   
    if( username == '' || password == ''  || valid == '' ){
	   
	/*   alert(2222);die();*/
	
	    $('#infotest').html("请完善您的登录信息");  
		return false;
		
		
	    }
    
	$.post('{:U('Login/userLogin')}',{username:username,password:password,valid:valid},function(data){
		
		
		
		if(data.status==100){
		
	    	/*alert(data.info);die;*/
		     $('#infotest').html(data.info);  
		     window.location='{:U('Index/index')}';
			}else{
			
	         /* $('#infotest').html(data.info);  
			      setTimeout(2000);*/
				  alert(data.info);
				     $('#infotest').html("");  
		    }
		})
	
	   

	
});
	</script>
</body>
</html>